[IA64] Fix a vtlb bug and do some cleanup
authorawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Fri, 12 May 2006 14:27:51 +0000 (08:27 -0600)
committerawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Fri, 12 May 2006 14:27:51 +0000 (08:27 -0600)
Signed-off-by: Anthony Xu <anthony.xu@intel.com>
xen/arch/ia64/vmx/vmmu.c
xen/arch/ia64/vmx/vtlb.c

index 75a54d0b691345a0708745e28d4eeca1f32829c8..d06d33039579e715b768fa76f5f443de0d594346 100644 (file)
@@ -138,7 +138,7 @@ static void init_domain_vhpt(struct vcpu *v)
     }
     vbase = page_to_virt(page);
     memset(vbase, 0, VCPU_VHPT_SIZE);
-    printk("Allocate domain tlb at 0x%p\n", vbase);
+    printk("Allocate domain vhpt at 0x%p\n", vbase);
     
     VHPT(v,hash) = vbase;
     VHPT(v,hash_sz) = VCPU_VHPT_SIZE/2;
@@ -161,7 +161,7 @@ void init_domain_tlb(struct vcpu *v)
     }
     vbase = page_to_virt(page);
     memset(vbase, 0, VCPU_VTLB_SIZE);
-    printk("Allocate domain tlb at 0x%p\n", vbase);
+    printk("Allocate domain vtlb at 0x%p\n", vbase);
     
     VTLB(v,hash) = vbase;
     VTLB(v,hash_sz) = VCPU_VTLB_SIZE/2;
index ca5fce65364dd4ec49c31590634b8d29dbbc6063..7b7481ffbf18f7672c0278d2d12331e9d0fe8d54 100644 (file)
@@ -274,36 +274,36 @@ thash_data_t * vhpt_lookup(u64 va)
 static void vtlb_purge(thash_cb_t *hcb, u64 va, u64 ps)
 {
     thash_data_t *hash_table, *prev, *next;
-    u64 start, end, size, tag, rid;
+    u64 start, end, size, tag, rid, def_size;
     ia64_rr vrr;
     vcpu_get_rr(current, va, &vrr.rrval);
     rid = vrr.rid;
     size = PSIZE(ps);
     start = va & (-size);
     end = start + size;
+    def_size = PSIZE(vrr.ps);
     while(start < end){
         hash_table = vsa_thash(hcb->pta, start, vrr.rrval, &tag);
-//         tag = ia64_ttag(start);
         if(!INVALID_TLB(hash_table)){
-       if(hash_table->etag == tag){
-            __rem_hash_head(hcb, hash_table);
-       }
-           else{
-           prev=hash_table;
-               next=prev->next;
-               while(next){
-                       if(next->etag == tag){
-                           prev->next=next->next;
-                           cch_free(hcb,next);
-                           hash_table->len--;
-                           break;
-                       }
-                       prev=next;
-                   next=next->next;
-           }
-       }
+            if(hash_table->etag == tag){
+                __rem_hash_head(hcb, hash_table);
+            }
+            else{
+                prev=hash_table;
+                next=prev->next;
+                while(next){
+                    if(next->etag == tag){
+                        prev->next=next->next;
+                        cch_free(hcb,next);
+                        hash_table->len--;
+                        break;
+                    }
+                    prev=next;
+                    next=next->next;
+                }
+            }
         }
-           start += PAGE_SIZE;
+        start += def_size;
     }
 //    machine_tlb_purge(va, ps);
 }
@@ -319,26 +319,26 @@ static void vhpt_purge(thash_cb_t *hcb, u64 va, u64 ps)
     start = va & (-size);
     end = start + size;
     while(start < end){
-       hash_table = (thash_data_t *)ia64_thash(start);
-           tag = ia64_ttag(start);
-       if(hash_table->etag == tag ){
+        hash_table = (thash_data_t *)ia64_thash(start);
+        tag = ia64_ttag(start);
+        if(hash_table->etag == tag ){
             __rem_hash_head(hcb, hash_table);
-       }
-           else{
-           prev=hash_table;
-               next=prev->next;
-               while(next){
-                       if(next->etag == tag){
-                           prev->next=next->next;
-                           cch_free(hcb,next);
-                           hash_table->len--;
-                           break;
-                       }
-                       prev=next;
-                   next=next->next;
-           }
-       }
-           start += PAGE_SIZE;
+        }
+        else{
+            prev=hash_table;
+            next=prev->next;
+            while(next){
+                if(next->etag == tag){
+                    prev->next=next->next;
+                    cch_free(hcb,next);
+                    hash_table->len--;
+                    break;
+                }
+                prev=next;
+                next=next->next;
+            }
+        }
+        start += PAGE_SIZE;
     }
     machine_tlb_purge(va, ps);
 }